OBJModel = function () {
	Sim.Object.call(this);
}

goog.inherits(OBJModel, Sim.Object);
OBJModel.prototype.Class = 'OBJModel';

OBJModel.prototype.init = function (param) {
	var group = new THREE.Object3D;

	var that = this;

	this.loadCallback = param.callback;

	var scale = param.scale || 1;

	this.scale = new THREE.Vector3(scale, scale, scale);

	var manager = new THREE.LoadingManager();

	new THREE.MTLLoader(manager).setPath(param.path)
		.load(param.mtlName, function (materials) {
			materials.preload();
			new THREE.OBJLoader(manager).setMaterials(materials)
				.setPath(param.path)
				.load(param.objName, function (model) {
					that.handleLoaded(model);
				})
		})

	// Tell the framework about our object
	this.setObject3D(group);
}


OBJModel.prototype.handleLoaded = function (model) {

	this.object3D.add(model);

	this.mesh = model;

	console.log(model);

	if (this.loadCallback) {
		this.loadCallback(this);
	}

}